package api.http.file.api;

import api.base.bean.BasicResponse;
import api.http.file.bean.UpLoatBean;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;

/**
 * Created by Administrator on 2018-01-12.
 */
//一个service里面尽量多写点，要不然要写好多逻辑


public interface UpdataFileService {

    @Headers({"Content-Type: application/vnd.ms-powerpoint", "Accept: application/json","X-Bmob-Application-Id:4fe24b0047944684797debc3d5bc4441","X-Bmob-REST-API-Key:69ac53428d6a48a8ae37745947cdc43e"})
    @POST("2/files/"+"{fileName}")
    Observable<BasicResponse<UpLoatBean>> addObject(@Path("fileName") String fileName, @Body RequestBody map);//请求体


    @Headers({"Content-Type: application/vnd.ms-powerpoint",
            "X-Bmob-Application-Id:4fe24b0047944684797debc3d5bc4441","X-Bmob-REST-API-Key:69ac53428d6a48a8ae37745947cdc43e"})
    @Multipart
    @POST("2/files/"+"{fileName}")
    Observable<BasicResponse<UpLoatBean>> upload(@Part("description") RequestBody description,
                                                 @Part MultipartBody.Part file);
}
